using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RBAC.Domain.WarehouseManagement;
using RBAC.ErrorCode;
using RBAC.Read.Api.Application.Command.ERP.LoggingTables;

namespace RBAC.Read.Api.Controllers.ERP
{
    /// <summary>
    /// 记录日志控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LoggingController : ControllerBase
    {
        private readonly IMediator mediator;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mediator">消息中介</param>
        public LoggingController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 获取日志记录列表（分页）
        /// </summary>
        /// <param name="request">分页参数</param>
        /// <returns>日志分页列表</returns>
        [HttpGet]
        public Task<APIResult<APIPaging<LoggingTable>>> GetLoggingList([FromQuery] GetLoggingCommands request)
        {
            return mediator.Send(request);
        }
    }
}
